From 0a5caebe25781d8762dae426864528e55a441587 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20Davidovi=C4=87?= Date: Wed, 24 Dec 2014 03:56:11 +0100 Subject: [PATCH] Fix fn type mismatch error rustc complains that we cannot assign two different fn's to a single object within an if-else block. I was not able to figure out what causes this; so deferring the execution of the particular function is a reasonable fallback. Not very elegant and should be changed to something with less boilerplate --- src/cargo/ops/cargo_rustc/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 115ee0443..348ff2ebf 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -201,7 +201,6 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, // a real job. Packages which are *not* compiled still have their jobs // executed, but only if the work is fresh. This is to preserve their // artifacts if any exist. - let job = if compiled {Job::new} else {Job::noop}; if !compiled { jobs.ignore(pkg); } if targets.is_empty() { @@ -253,7 +252,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, try!(work.call(desc_tx.clone())); dirty.call(desc_tx) }); - dst.push((job(dirty, fresh), freshness)); + dst.push((if compiled { Job::new(dirty, fresh) } else { Job::noop(dirty, fresh) }, freshness)); } // If this is a custom build command, we need to not only build the @@ -290,7 +289,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, } let (dirty, fresh, freshness) = try!(custom_build::prepare(pkg, target, req, cx)); - run_custom.push((job(dirty, fresh), freshness)); + run_custom.push((if compiled { Job::new(dirty, fresh) } else { Job::noop(dirty, fresh) }, freshness)); } // If no build scripts were run, no need to compile the build script! @@ -329,7 +328,7 @@ fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, dirty.call(desc_tx) }); jobs.enqueue(pkg, Stage::BuildCustomBuild, vec![]); - jobs.enqueue(pkg, Stage::RunCustomBuild, vec![(job(dirty, fresh), + jobs.enqueue(pkg, Stage::RunCustomBuild, vec![(if compiled { Job::new(dirty, fresh) } else { Job::noop(dirty, fresh) }, freshness)]); } -- 2.30.2